<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>客户管理</title>
    <%@include file="/WEB-INF/views/common/link.jsp"%>

    <script>
        function moveSelected(src, target) {
            console.log(src)
            // $(".selfRoles").append($(".allRoles > option:selected"))
            $("."+target).append($("."+src+"> option:selected"))
        }

        function moveAll(src, target) {
            $("."+target).append($("." + src + " > option"))
        }
        //表单提交
        var roleDiv
        $(function () {
            $("#submitBtn").click(function () {
                console.log(this)
                //提交之前将selfRoles中的option为选中状态
                $(".selfRoles > option").prop("selected", true)
                $("#editForm").submit()
            })

            $("#admin").click(function () {
                handAdminChecked()
            })

            handAdminChecked()
        })

        function handAdminChecked() {
            var checked = $("#admin").prop("checked");
            if (checked){
                roleDiv = $("#role").detach();
            }else {
                $("#adminDiv").after(roleDiv)
            }
        }

    </script>

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@include file="/WEB-INF/views/common/navbar.jsp"%>
    <!--菜单回显-->
    <c:set var="currentMenu" value="customer"/>
    <%@include file="/WEB-INF/views/common/menu.jsp"%>
    <div class="content-wrapper">
        <section class="content-header">

            <c:choose>
                <c:when test="${empty customer}">
                    <h1>添加员工</h1>
                </c:when>
                <c:otherwise>
                    <h1>编辑员工</h1>
                </c:otherwise>
            </c:choose>

        </section>
        <section class="content">
            <div class="box">
                <form class="form-horizontal" action="/customer/saveOrUpdate" method="post" id="editForm">
                    <input type="hidden" value="${customer.id}" name="id" >
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">姓名：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="name" name="name" value="${customer.name}" placeholder="请输入用户名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="name" class="col-sm-2 control-label">年龄：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="age" name="age" value="${customer.age}" placeholder="请输入年龄">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="name" class="col-sm-2 control-label">性别：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="gender" name="gender" value="${customer.gender}" placeholder="请输入性别">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="age" class="col-sm-2 control-label">电话：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="tel" name="tel" value="${customer.tel}" placeholder="请输入电话">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">qq：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="qq" name="qq" value="${customer.qq}" placeholder="请输入qq">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">工作：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="job" name="job" value="${customer.job}" placeholder="请输入工作">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">来源：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="source" name="source" value="${customer.source}" placeholder="请输入来源">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">状态：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="status" name="status" value="${customer.status}" placeholder="请输入状态">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-2 control-label">负责人：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="seller" name="seller" value="${customer.seller}" placeholder="请输入负责人">
                        </div>
                    </div>









                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-6">
                            <button id="submitBtn" type="button" class="btn btn-primary">保存</button>
                            <button type="reset" class="btn btn-danger">重置</button>
                        </div>
                    </div>

                </form>

            </div>
        </section>
    </div>
    <%@include file="/WEB-INF/views/common/footer.jsp"%>
</div>
</body>
</html>
